package com.sly.demo.mapstruct.mapper;

import com.sly.demo.mapstruct.model.po.Goods;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 商品mapper（这里只做DEMO示范，因此没有去真正按照查询数据库去写）
 * @author SLY
 * @date 2022/8/7
 */
@Component
public class GoodsMapper {
    public List<Goods> findGoodsList() {
        List<Goods> list = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            Goods goods = new Goods();
            goods.setId(i + 1);
            goods.setName("商品" + goods.getId());
            goods.setPrice(new BigDecimal(i + 1));
            goods.setCount(new BigDecimal(i + 1));
            goods.setStatus(1);
            list.add(goods);
        }
        return list;
    }
}
